<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>test</title>
    <script src="./qwebchannel.js"></script>
    <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
  </head>
  <body style="background:#282c34;">
    <h3 style="color:#ffffff;">Hello World!</h3>
    <input type="button" value="C++ function callback" onclick="onShowMsgBox()">
    <input type="button" value="get your name " onclick="onGetYourName()">
    <script>
      new QWebChannel(qt.webChannelTransport, function(channel) {
        window.bridge = channel.objects.bridge;
        window.bridge.sigYourName.connect(function(name) {
          alert(name);
        });
      });

      function onShowMsgBox() {
        bridge.showMsgBox()
      }

      function onGetYourName() {
        bridge.getYourName();
      }

      function showAlert() {
        alert('this is web alert');
      }

      function getWindowWidth() {
        return $(window).width();
      }
    </script>
  </body>
</html>
